Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: QuickTime

Previous | Overview | Contents | Next |

Getting Information About Compressor Components

This section describes the functions that allow your application to gather information about the Image Compression Manager and the installed compressor components.

You can use the CodecManagerVersion function to retrieve the version number associated with the Image Compression Manager that is installed on a particular computer.

You can use the FindCodec , GetCodecInfo , and GetCodecNameList functions to locate and retrieve information about the compressor components that are available on a computer.

CodecManagerVersion

Your application can determine the version of the installed Image Compression Manager by calling the CodecManagerVersion function.

pascal OSErr CodecManagerVersion (long *version);
version
Contains a pointer to a long integer that is to receive the version information. The Image Compression Manager returns its version number into this location. The version number is a long integer value.

DESCRIPTION

The CodecManagerVersion function returns the version information as a long integer value.

RESULT CODES

noErr

0

No error

SEE ALSO

"Getting Information About Compressors and Compressed Data," which begins on Getting Information About Compressors and Compressed Data , describes how to use CodecManagerVersion .

GetCodecNameList

The GetCodecNameList function allows your application to retrieve a list of installed compressor components or a list of installed compressor types. This information may be useful when the user selects a compression type for a given image or sequence.

pascal OSErr GetCodecNameList (CodecNameSpecListPtr *list,
                                          short showAll);
list
Contains a pointer to a field that is to receive a pointer to the compressor name list structure. The Image Compression Manager creates the appropriate list and returns a pointer to that list in the field specified by the list parameter. Note that the GetCodecNameList function creates this list in your application's current heap zone.

showAll
Specifies a short integer that controls the contents of the list. Set this parameter to 1 to receive a list of the names of all installed compressor components--the returned list contains one entry for each installed compressor. Set this parameter to 0 to receive a list of the types of installed compressor components--the returned list contains one entry for each installed compressor type. See "The Compressor Name List Structure" for a complete description of the contents of the returned list.

DESCRIPTION

The Image Compression Manager returns this information in a compressor name list structure, which contains an array of compressor name structures and a field indicating the number of structures in the array.

The CodecType data type defines a field in the compressor name list structure that identifies the compression method employed by a given compressor component. Apple Computer's Developer Technical Support group assigns these values so that they remain unique. These values correspond, in turn, to text strings that can identify the compression method to the user.

typedef long CodecType;         
/* compressor type descriptor--for example 'jpeg','rle ',
     'rpza' */

Currently, six CodecType values are provided by Apple. You should use the GetCodecNameList function to retrieve these names, so that your application can take advantage of new compressor types that may be added in the future. For each CodecType value in the following list, the corresponding compression method is also identified by its text string name. For more information about each of these compression techniques, see the section "About Image Compression," which begins on About Image Compression .

Table 3 Compressor type descriptors

Compressor type

Compressor name

'rpza '
video compressor
'jpeg'
photo compressor
'rle '
animation compressor
'raw '
raw compressor
'smc '
graphics compressor
'cvid'
compact video compressor (cinepak)

SPECIAL CONSIDERATIONS

Note that the Image Compression Manager returns the list in your application's current heap zone. Use the DisposeCodecNameList function, described in the next section, to release this memory when your program is finished with the list.

RESULT CODES

noErr

0

No error

paramErr

-50

Invalid parameter specified

Component Manager errors Memory Manager errors

DisposeCodecNameList

The DisposeCodecNameList function allows your application to dispose of the compressor name list structure you obtained by calling the GetCodecNameList function.

pascal OSErr DisposeCodecNameList (CodecNameSpecListPtr list);
list
Points to the compressor name list to be disposed of. You obtain the compressor list by calling the GetCodecNameList function, which is described in the previous section.

RESULT CODES

noErr

0

No error

Memory Manager errors

GetCodecInfo

The GetCodecInfo function returns information about a single compressor component.

pascal OSErr GetCodecInfo (CodecInfo *info, CodecType cType,
                                          CodecComponent codec);
info
Contains a pointer to a compressor information structure. The GetCodecInfo function returns the detailed information about the appropriate compressor component into this structure.

cType
Specifies a compressor type. You must set this parameter to a valid compressor type (see Table 3 for a list of the available compressor types).

codec
Specifies a compressor identifier. Set this parameter to the component identifier of the specific compressor for the request. The component identifier is available in the compressor name list structure returned by the GetCodecNameList function (described on GetCodecNameList ).

If you want information about any compressor of the type specified by the cType parameter, set codec to 0. The Image Compression Manager then returns information about the first compressor it finds of the type you have specified.

DESCRIPTION

Your application may retrieve information about a specific compressor or about a compressor of a specific type. If you request information about a type of compressor, the Image Compression Manager returns information about the first compressor it finds of that type. The Image Compression Manager returns the detailed compressor information in a compressor information structure (see "The Compressor Information Structure," which begins on The Compressor Information Structure , for details).

RESULT CODES

noErr

0

No error

noCodecErr

-8961

The Image Compression Manager could not find the specified compressor

Component Manager errors Memory Manager errors

FindCodec

The FindCodec function allows you to determine which of the installed compressors or decompressors has been chosen to field requests made using one of the special compressor identifiers.

Some Image Compression Manager functions allow you to specify a particular compressor component. For example, you may use the codec parameter to the CompressSequenceBegin function (described on CompressSequenceBegin ) to specify a particular compressor to do the compression.

You identify the compressor to the Image Compression Manager by specifying the compressor's component identifier (see the description of the GetCodecNameList function on GetCodecNameList for information on retrieving these identifiers).

The Image Compression Manager also supports several special identifiers that allow you to exert some control over the component for a given action without having to know its identifier.

pascal OSErr FindCodec (CodecType cType, CodecComponent specCodec,
                                          CompressorComponent *compressor,
                                          DecompressorComponent *decompressor);
cType
Specifies a compressor type. You must set this parameter to a valid compressor type (see Table 3 for a list of the available compressor types).

specCodec
Contains a special identifier value. You must set this parameter to one of the following special identifier values:

anyCodec
Choose the first compressor or decompressor of the specified type

bestSpeedCodec
Choose the fastest compressor or decompressor of the specified type

bestFidelityCodec
Choose the most accurate compressor or decompressor of the specified type

bestCompressionCodec
Choose the compressor that produces the smallest resulting data

compressor
Contains a pointer to a field to receive the identifier for the compressor component. The Image Compression Manager returns the identifier of the compressor that meets the special characteristics you specify in the specCodec parameter. Note that this identifier may differ from the value of the field referred to by the decompressor field. The Image Compression Manager sets this field to 0 if it cannot find a suitable compressor component. Set this parameter to nil if you do not want this information.

decompressor
Contains a pointer to a field to receive the identifier for the decompressor component. The Image Compression Manager returns the identifier of the decompressor that meets the special characteristics you specify in the specCodec parameter. Note that this identifier may differ from the value of the field referred to by the compressor field. The Image Compression Manager sets this field to 0 if it cannot find a suitable decompressor component. Set this parameter to nil if you do not want this information.

DESCRIPTION

You can use the FindCodec function to obtain the identifier of the component that is being used to field requests made with one of the special compressor identifiers.

RESULT CODES

n oErr

0

No error

paramErr

-50

Invalid parameter specified

memFullErr

-108

Not enough memory available

noCodecErr

-8961

The Image Compression Manager could not find the specified compressor


© 1999 Apple Computer, Inc.

Previous | Overview | Contents | Next